#_*_coding:utf-8_*_
__author__ = 'kom'

def parse_jsjson(expr):
    import ast
    m = ast.parse(expr)
    a = m.body[0]
    def parse(node):
        if isinstance(node, ast.Expr):
            return parse(node.value)
        elif isinstance(node, ast.Num):
            return node.n
        elif isinstance(node, ast.Str):
            return node.s
        elif isinstance(node, ast.Name):
            return node.id
        elif isinstance(node, ast.Dict):
            return dict(zip(map(parse, node.keys), map(parse, node.values)))
        elif isinstance(node, ast.List):
            return map(parse, node.elts)
        else:
            raise NotImplementedError(node.__class__)
    return parse(a)


if __name__ == '__main__':
    url="http://www.cmbchina.com/cfweb/svrajax/product.ashx?op=search&type=s&pageindex=1&pagesize=15&salestatus=&baoben=&currency=&term=&keyword=&series=01&risk=&city=&date=&orderby="
    import urllib2
    r = urllib2.urlopen(url).read()
    hex=parse_jsjson(r[1:-1])
    lists=hex["list"]
    print hex["list"]
    print hex["list"][0].keys()
    for i in lists[0]:
        print "%s:%s" % (i,lists[0][i])
    #for l in lists:
     #   print l["PrdCode"]